#include "LongLatLabel.h"
#include "ui_LongLatLabel.h"
#include "Util.h"

void LongLatLabelRect(QWidget* parent, QWidget* self, QRect& rect, bool isInit)
{
	rect = self->rect();
	rect.setX(parent->width() - rect.width());
	rect.setY(parent->y());
}

LongLatLabel::LongLatLabel(QWidget *parent)
	: QWidget(parent)
{
	ui = new Ui::LongLatLabel();
	ui->setupUi(this);

	m_filter = new FloatWidgetEventFilter(parent,this);
	m_filter->SetVisible(true);
	m_filter->SetRectInfoCallback(LongLatLabelRect);
}

LongLatLabel::~LongLatLabel()
{
	delete ui;
}

void LongLatLabel::set(qreal longitude, qreal latitude)
{
	ui->longlatLabel->setText(Util::LoLaDecToDmsText(longitude, latitude));
}
